package com.harboursoftware.xstorage.db.sql;

import java.sql.ResultSet;
import java.sql.SQLException;

import com.harboursoftware.xstorage.model.XUser;

/**
 * 
 * @author Simon Leung
 * @since 0.1
 */
public class UserRowProcessor extends BaseRowProcessor {

    @SuppressWarnings("unchecked")
    @Override
    public <T> T toBean(ResultSet rs, Class<T> type) throws SQLException {
        XUser user = new XUser();
        user.setId(rs.getString("id"));
        user.setAccessKeyId(rs.getString("access_key_id"));
        user.setSecretAccessKey(rs.getString("secret_access_key"));
        user.setEmail(rs.getString("email"));
        user.setDisplayName(rs.getString("display_name"));
        return (T)user;
    }

}
